package xyz.ddlnt.servicemgclient.client.fallback;

import org.springframework.cloud.openfeign.FallbackFactory;
import xyz.ddlnt.commonutil.enumeration.ResultCode;
import xyz.ddlnt.commonutil.exception.GlobalException;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.dto.ExamQuestionDTO;
import xyz.ddlnt.model.dto.PublishStatus;
import xyz.ddlnt.model.vo.ExamQuestionInfoVO;
import xyz.ddlnt.model.vo.ExamQuestionVO;
import xyz.ddlnt.servicemgclient.client.ExamQuestionFeignClient;

import java.util.List;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/3 23:45
 */
public class ExamQuestionFallbackFactory implements FallbackFactory<ExamQuestionFeignClient> {
    @Override
    public ExamQuestionFeignClient create(Throwable cause) {
        return new ExamQuestionFeignClient() {

            @Override
            public Result<ExamQuestionVO> addExamQuestion(ExamQuestionDTO examQuestionDTO) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<Boolean> deleteExamQuestion(Long id) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<ExamQuestionVO> updateExamQuestion(ExamQuestionDTO examQuestionDTO) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<Boolean> updatePublishStatus(PublishStatus publishStatus) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<ExamQuestionInfoVO> getExamQuestionById(Long id) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }

            @Override
            public Result<List<ExamQuestionVO>> getExamQuestions() {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }
        };
    }
}
